export function renderPieChart(name, data) {
	return {
		tooltip: {
			confine: true,
			trigger: 'item',
			formatter: '{b}: {c} ({d}%)',
		},
		grid: {
			top: 0,
			right: 0,
			bottom: 0,
			left: 0,
		},
		series: [
			{
				name: name,
				type: 'pie',
				radius: ['65%', '80%'],
				center: ['50%', '50%'],
				avoidLabelOverlap: false,
				label: {
					show: false,
				},
				emphasis: {
					label: {
						show: false,
						fontSize: '20',
						fontWeight: 'normal',
					},
				},
				labelLine: {
					show: false,
				},
				data: data.map(item => {
					return {
						value: item.value,
						name: item.name,
						itemStyle: { color: item.color },
					};
				}),
			},
		],
	};
}
